# Contributor: Curt Tilmes <Curt.Tilmes@nasa.gov>
# Maintainer: Curt Tilmes <Curt.Tilmes@nasa.gov>
pkgname=moarvm
pkgver=2022.06
pkgrel=0
pkgdesc="A VM with adaptive optimization and JIT compilation, built for Rakudo"
url="https://moarvm.org/"
# riscv64 doesn't compile, "Cannot implement AO_compare_and_swap_full on this architecture"
arch="all !riscv64"
license="Artistic-2.0"
depends_dev="$pkgname=$pkgver-r$pkgrel perl zstd-dev libffi-dev libuv-dev"
makedepends="$depends_dev"
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://moarvm.org/releases/MoarVM-$pkgver.tar.gz"
builddir="$srcdir"/MoarVM-"$pkgver"
options="!check" # No tests

build() {
	unset CPPFLAGS CFLAGS
	perl Configure.pl --prefix=/usr --has-libffi \
		--has-libuv --no-mimalloc --debug
	make -j"$JOBS"
}

package() {
	make PKGCONFIGDIR=/usr/lib/pkgconfig \
		DESTDIR="$pkgdir" install

	install -Dvm644 Artistic2.txt CREDITS LICENSE \
		MANIFEST README.markdown VERSION \
		-t "$pkgdir"/usr/share/doc/"$pkgname"
	cp -vr docs "$pkgdir"/usr/share/doc/"$pkgname"/
}

dev() {
	default_dev
	amove usr/share/nqp/lib
}

sha512sums="
2a47fcd2e3d8ed0bd3845ec04f0bb8ead87190985e7b83acfa4f726ccc0f544d93bfb7fad5dcedfd09739c41632abb1618a128936a1053c5b0b85ca1857f87c3  moarvm-2022.06.tar.gz
"
